//
//  PurchaseApi.swift
//  MT
//
//  Created by M on 2019/12/31.
//  Copyright © 2019 张强. All rights reserved.
//

import UIKit
import Moya
import DeviceKit
import SwiftyRSA
import Security

import Result

enum PurchaseApi {
    case queryDetail(_ params: [String:Any])
}


// MARK: ------------------ Api 参数 ----------------------
extension PurchaseApi: MTTargetType {

    /// 请求头
    public var headers: [String : String]? {
        guard let accessToken = UserDefaults.MTUserCenter.token.storedString else { return nil }
        return ["Access-Token": accessToken]
    }
    
    /// 基路径
    public var baseURL: URL {
        return URL(string: AuthServerBaseUrl)!
    }
    
    /// 路径
    public var path: String {
        switch self {
        case .queryDetail:                  return "/purchase/queryDetail"
        }
    }
    
    /// 请求方法
    public var method: Moya.Method {
        switch self {
        default:        return .post
        }
    }
    
    /// 参数
    var params: [String: Any]? {
        
        switch self {
        case let .queryDetail(params):
            return params
        }
        
    }
    
}

